USE [influenza]
GO

/****** Object:  StoredProcedure [dbo].[SP_ActualizaLaboratorioISSSTE]    Script Date: 01/29/2010 19:06:08 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[SP_ActualizaLaboratorioISSSTE]
@nRegistro varchar(8)
as
Begin

set dateformat mdy

declare @qry varchar(8000)

set @qry='SELECT b.cFolio,g.cId_Origen,c.nLabResultado,c.nStatus
				FROM dat_laboratorio a 
				INNER JOIN aux_muestras b ON (a.id_registro = b.id_principal)
				LEFT JOIN dat_registro c ON (a.id_registro = c.id_principal)
				INNER JOIN dat_generales g ON (c.id_generales = g.id_principal)
				WHERE a.id_registro ='+@nRegistro+' AND g.cId_Origen IS NOT NULL'
exec (@qry)
END

GO

